package cn.declare.config;

import cn.declare.controller.UserController;
import cn.declare.interceptors.JWTInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Author：葛鑫
 * 配置拦截与放行的请求
 */

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new JWTInterceptor())
                .addPathPatterns("/**") //其他接口token验证保护
                .excludePathPatterns("/user/**")//放行请求;
                .excludePathPatterns("/energy/**")//放行请求;
                .excludePathPatterns("/talent/**")
                .excludePathPatterns("/log/**")
                .excludePathPatterns("/key/**")//放行请求;
                .excludePathPatterns("/appeal/**"); //放行请求;
    }
}
